package com.example.leetcode.niuke;

import java.util.Scanner;

public class NiuKe8 {

  //输入
  //yM eman si boB.
  //输出
  //My name is Bob.
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] split = s.split(" ");
        StringBuilder sb = new StringBuilder();
        for (int j = 0; j<split.length;j++) {
            String s1 = split[j];
            for (int i = s1.length() -1 ;i>=0;i--) {
                if (!isCharacter(s1.charAt(i))) {
                    continue;
                }
                sb.append(s1.charAt(i));
            }
            if (j != split.length -1) {
                sb.append(" ");
            }else {
                sb.append(split[j].charAt(split[j].length() -1));
            }
        }
        System.out.println(sb.toString());
    }

    private static boolean isCharacter(char c) {
        if (c == 63 || c== 46) {
            return false;
        }
        return true;
    }
}
